package learn_concurrent._1;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class T3 {
	final static Logger logger = LoggerFactory.getLogger(T3.class);

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		FutureTask<Integer> task = new FutureTask<>(() -> {
			logger.debug("running...");
			Thread.sleep(2000);
			return 100;
		});
		
		new Thread(task, "t-1").start();
		Integer result = task.get();
		logger.debug("{}", result);
	}

}
